Method and device for n-gram identification and extraction

ABSTRACT

A method and device for n-gram identification and extraction is disclosed. The method includes identifying at least one n-gram from a sentence inputted by a user based on a confidence score associated with each of the at least one n-gram. The method further includes determining a direction context entropy coefficient for each of the at least one n-gram. The method includes iteratively expanding one or more of the at least one n-gram by the smallest n-gram unit at each iteration in a predefined direction in the sentence to generate at least one expanded n-gram, based on an associated direction context entropy coefficient. The method further includes extracting at each expanding iteration one or more of the at least one expanded n-gram based on an associated confidence score. The method includes grouping semantically linked n-grams from the one or more of the at least one expanded n-gram.

TECHNICAL FIELD

This disclosure relates generally to n-grams and more particularly tomethod and device for n-gram identification and extraction.

BACKGROUND

Identification and extraction of n-grams from text sequence is useful inidentifying similar context and to extract different variations throughsemantics. It can also be used to generate variety of sentences wheren-grams are preserved without losing the sequence and meaning.Identifying and extracting n-grams is very essential in manyapplications of natural language processing, word contextdisambiguation, and web searching. However, there are high chances oflosing contextual information as well as sequence and meaning of theextracted text sequence, if the identification and extraction is notdone correctly and in an efficient manner. Conventional systemsadditionally fail to tackle semantically similar and semanticallyrelated words in the n-gram sequence.

SUMMARY

In one embodiment, a method for n-gram identification and extraction isdisclosed. The method includes identifying, by a computing device, atleast one n-gram from a sentence inputted by a user based on aconfidence score associated with each of the at least one n-gram,wherein a confidence score for an n-gram is computed based on comparisonof the n-gram with existing word patterns. The method further includesdetermining, by the computing device, a direction context entropycoefficient for each of the at least one n-gram, based on the existingword patterns. The method includes iteratively expanding, by thecomputing device, one or more of the at least one n-gram by the smallestn-gram unit at each iteration in a predefined direction in the sentenceto generate at least one expanded n-gram, based on an associateddirection context entropy coefficient. The method further includesextracting at each expanding iteration, by the computing device, one ormore of the at least one expanded n-gram based on a confidence scoreassociated with each of the one or more of the at least one expandedn-gram, wherein a confidence score for an expanded n-gram is computedbased on comparison of the expanded n-gram with the existing wordpatterns. The method includes grouping, by the computing device,semantically linked n-grams from the one or more of the at least oneexpanded n-gram.

In another embodiment, a computing device for n-gram identification andextraction is disclosed. The computing device includes a processor and amemory communicatively coupled to the processor, wherein the memorystores processor instructions, which, on execution, causes the processorto identify at least one n-gram from a sentence inputted by a user basedon a confidence score associated with each of the at least one n-gram,wherein a confidence score for an n-gram is computed based on comparisonof the n-gram with existing word patterns. The processor instructionsfurther cause the processor to determine a direction context entropycoefficient for each of the at least one n-gram, based on the existingword patterns. The processor instructions cause the processor toiteratively expand one or more of the at least one n-gram by thesmallest n-gram unit at each iteration in a predefined direction in thesentence to generate at least one expanded n-gram, based on anassociated direction context entropy coefficient. The processorinstructions further cause the processor to extract at each expandingiteration one or more of the at least one expanded n-gram based on aconfidence score associated with each of the one or more of the at leastone expanded n-gram, wherein a confidence score for an expanded n-gramis computed based on comparison of the expanded n-gram with the existingword patterns. The processor instructions cause the processor to groupsemantically linked n-grams from the one or more of the at least oneexpanded n-gram.

In yet another embodiment, a non-transitory computer-readable storagemedium is disclosed. The non-transitory computer-readable storage mediumhas instructions stored thereon, a set of computer-executableinstructions causing a computer comprising one or more processors toperform steps comprising identifying at least one n-gram from a sentenceinputted by a user based on a confidence score associated with each ofthe at least one n-gram, wherein a confidence score for an n-gram iscomputed based on comparison of the n-gram with existing word patterns;determining a direction context entropy coefficient for each of the atleast one n-gram, based on the existing word patterns; iterativelyexpanding one or more of the at least one n-gram by the smallest n-gramunit at each iteration in a predefined direction in the sentence togenerate at least one expanded n-gram, based on an associated directioncontext entropy coefficient; extracting at each expanding iteration oneor more of the at least one expanded n-gram based on a confidence scoreassociated with each of the one or more of the at least one expandedn-gram, wherein a confidence score for an expanded n-gram is computedbased on comparison of the expanded n-gram with the existing wordpatterns; and grouping semantically linked n-grams from the one or moreof the at least one expanded n-gram.

It is to be understood that both the foregoing general description andthe following detailed description are exemplary and explanatory onlyand are not restrictive of the invention, as claimed.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of this disclosure, illustrate exemplary embodiments and, togetherwith the description, serve to explain the disclosed principles.

FIG. 1 is a block diagram illustrating a system for identifying andextracting n-grams from sentences, in accordance with an embodiment.

FIG. 2 is a block diagram illustrating various modules within a memoryof a computing device configured to identify and extract n-grams fromsentences, in accordance with an embodiment.

FIG. 3 illustrates a flowchart of a method for identifying andextracting n-grams from sentences, in accordance with an embodiment.

FIGS. 4A and 4B illustrates a flowchart of a method for identifying andextracting n-grams from sentences, in accordance with anotherembodiment.

FIG. 5 illustrates a block diagram of an exemplary computer system forimplementing various embodiments.

DETAILED DESCRIPTION

Exemplary embodiments are described with reference to the accompanyingdrawings. Wherever convenient, the same reference numbers are usedthroughout the drawings to refer to the same or like parts. Whileexamples and features of disclosed principles are described herein,modifications, adaptations, and other implementations are possiblewithout departing from the spirit and scope of the disclosedembodiments. It is intended that the following detailed description beconsidered as exemplary only, with the true scope and spirit beingindicated by the following claims.

Additional illustrative embodiments are listed below. In one embodiment,a system 100 for identifying and extracting n-grams from sentences, isillustrated in FIG. 1. The sentences may be natural language sentencesoccurring within documents. Examples of these documents may include, butare not limited to PDF documents, images, or web-pages. Alternatively,the sentences may be natural language sentences inputted by a usereither vocally (for example, on an Interactive Voice Response (IVR)menu) or by way of text (for example, on a chat window), A n-gram, maybe a contiguous sequence of n items from a given sequence of text orspeech. The items may be a sequence of syllables, alphabets, or words.However, in the current embodiment, n-gram is a contiguous sequence of“n” words. By way of an example, in the sentence: “I work with AmericanExpress in United States of America.” Each individual word is a unigram.In other words, “n” has a value of 1 in this case. By way of an example,following are few unigrams in the sentence given above: “American,”“United,” “America,” “Express,” and “States.” Similarly, two contiguouswords in sequence will form a bigram. In other words, “n” has a value of2 in this case. By way of an example, following are few bigrams in thesentence given above: “American Express,” and “United States.”Similarly, three contiguous words in a sequence will form a trigram. Inother words, “n” has a value of 3 in this case. By way of an example,following are few trigrams in the sentence given above: “United Statesof.” In a similar manner, an example of a tetra-gram in the sentencegiven above: “United States of American,” which includes fourscontiguous words in sequence.

System 100 includes a computing device 102 that identifies and extractsn-grams from sentences. Computing device 102, may be an applicationserver. It will be apparent from the examples given above that n-gramsextracted from a sentence help in ascertaining the context in whichindividual words have been used in a sentence. The sentences may beprovided by a user through a plurality of computing devices 104 (forexample, a laptop 104 a, a desktop 104 b, and a smart phone 104 c).Other examples of plurality of computing devices 104, may include, butare not limited to a phablet and a tablet. Plurality of computingdevices 104 are connected to computing device 102 via a network 106,which may be a wired or a wireless network and the examples may include,but are not limited to the Internet, Wireless Local Area Network (WLAN),Wi-Fi, Long Term Evolution (LTE), Worldwide Interoperability forMicrowave Access (WiMAX), and General Packet Radio Service (CPRS).

When a user of laptop 104 a, for example, provides a query in naturallanguage via an application installed in laptop 104 a, laptop 104 acommunicates with computing device 102, via network 106. Computingdevice 102 may convert the query into a natural language sentence (ifinputted verbally by the user) and thereafter may identify and extractn-grams from the query. To this end, computing device 102 includes aprocessor 108 that is communicatively coupled to a memory 110, which maybe a non-volatile memory or a volatile memory. Examples of non-volatilememory, may include, but are not limited to a flash memory, a Read OnlyMemory (ROM), a Programmable ROM (PROM), Erasable PROM (EPROM), andElectrically EPROM (EEPROM) memory. Examples of volatile memory mayinclude, but are not limited Dynamic Random Access Memory (DRAM), andStatic Random-Access memory (SRAM).

Memory 110 further includes various modules that enable computing device102 to identify and extract n-grams from sentences. These modules areexplained in detail in conjunction with FIG. 2. Computing device 102 mayfurther include a display 112 having a User Interface (UI) 114 that maybe used by a user or an administrator to provide various inputs tocomputing device 102. Display 112 may further be used to display resultof analysis performed by computing device 102. The functionality ofcomputing device 102 may alternatively be configured within each ofplurality of computing devices 104.

Referring now to FIG. 2, a block diagram illustrating various moduleswithin memory 110 of computing device 102 configured to identify andextract n-grams, in accordance with an embodiment. Memory 110 includesan n-gram identifier module 202, a direction context entropy module 204,an n-gram expanding module 206, a validator module 208, an n-gramextracting module 210, a filtering module 212, and a semanticallygrouping module 214.

Once a sentence has been inputted by a user, n-gram identifier module202 identifies one or more n-grams from the sentence. During initiationof the process, each of the one or more n-grams identified from thesentence may be unigrams. By way of an example, the sentence is: “I workwith American Express in United States of America” The unigramsidentified for this sentence include: “Work,” “With,” “I,” “American,”“United,” “America,” “Express,” and “States.” The one or more n-gramsmay be identified based on a confidence score associated with each ofthe one or more n-grams. A confidence score for an n-gram is computedbased on comparison of the n-gram with existing word patterns. Theexisting word patterns may be stored in a data repository (not shown inFIG. 1) in communication with computing device 102 via network 106. Theexisting word patterns may be added in the data repository based on testdata extracted from a word corpus that has an exhaustive list of wordpatterns. The data repository may be continuously updated based onidentification of new word patterns. This is further explained in detailin conjunction with FIG. 3.

Thereafter, direction context entropy module 204 determines a directioncontext entropy coefficient for each of the one or more n-grams. Thedirection context entropy coefficient includes a left context entropycoefficient and a right context entropy coefficient. When the leftcontext entropy coefficient for the n-gram is higher than an associatedpredefined context threshold, the n-gram is expanded in the leftdirection in the sentence. Alternatively, when the right context entropycoefficient for the n-gram is higher than an associated predefinedcontext threshold, the n-gram is expanded in the right direction in thesentence. This is further explained in detail in conjunction with FIG.3.

Based on the associated direction context entropy coefficient, n-gramexpanding module 206, at each iteration, iteratively expands one or moren-grams by the smallest n-gram unit in a predefined direction (i.e.,left direction or right direction) in the sentence to generate one ormore expanded n-grams. The smallest n-gram unit is a unigram. In otherwords, an n-gram is expanded by a unigram at each iteration. Thus, ifthe left direction context entropy coefficient is greater than theassociated predefined context threshold, the n-gram is expanded in theleft direction in the sentence. This is further explained in detail inconjunction with FIG. 3.

In an embodiment, validator module 208 validates expansion of each ofthe one or more n-grams in the predefined direction. The validation foran n-gram is performed based on one or more of an associated crosscontext entropy coefficient and an associated reverse cross contextentropy coefficient. These measures will give the confidence to expandeach of the one or more n-grams, in order to decide whether to expand ann-gram or to stop expansion of the n-gram. This is further explained indetail in conjunction with FIGS. 4A and 4B.

After validation, at each expanding iteration, n-gram extraction module210 extracts one or more expanded n-grams based on a confidence scoreassociated with each of the one or more expanded n-gram. In other words,after an n-gram has been expanded to generate an expanded n-gram, firsta confidence score is computed for the expanded n-gram, and based on theconfidence score for the expanded n-gram, the expanded n-gram isextracted or ignored. In an embodiment, the expanded n-gram is extractedif confidence score associated with the expanded n-gram is greater thanan associated threshold score. A confidence score for an expanded n-gramis computed based on comparison of the expanded n-gram with the existingword patterns. This is further explained in detail in conjunction withFIGS. 4A and 4B.

Filtering module 212 may then filter one or more of expanded n-gramsextracted above, based on associated one or more context divergencecoefficients. Each of one or more filtered n-grams have low relevancyconfidence score, which is determined based on the associated one ormore context divergence coefficients. The one or more context divergencecoefficients include a left context divergence coefficient and a rightcontext divergence coefficient. The one or more context divergencecoefficients further include a skew divergence coefficient and a reverseskew divergence coefficient, that validate the result obtained from theleft and right context divergence coefficients. This is furtherexplained in detail in conjunction with FIGS. 4A and 4B.

After filtering of one or more expanded n-grams that have beenextracted, semantically grouping module 214 then groups semanticallylinked n-grams from the one or more expanded n-grams extracted by n-gramextracting module 210. Thus, the semantically similar and semanticallyrelated instances or n-grams, which are not captured and/or ignored inprevious stages are identified and extracted. This is further explainedin detail in conjunction with FIG. 3.

Referring now to FIG. 3, a flowchart of a method for identifying andextracting n-grams from sentences is illustrated, in accordance with anembodiment. As explained in detail in FIG. 1 along with an example, ann-gram may be a contiguous sequence of “n” number of words from a givensequence of text or speech. In an embodiment, n-gram may be a contiguoussequence of syllables, alphabets, or words. An n-gram that includes asingle word is a unigram, an n-gram that includes two contiguous wordsis a bigram, an n-gram that includes three contiguous word is a unigram,and so on and so forth. The sentence may be a natural language sentenceinputted by a user either vocally (for example, on an Interactive VoiceResponse (IVR) menu) or by way of text (for example, on a chat window).The method is a Bootstrapping based method that includes incrementallearning of n-grams identification and extraction.

Once a sentence has been inputted by a user, computing device 102, atstep 302, identifies one or more n-grams from the sentence. Duringinitiation of the process, each of the one or more n-grams identifiedfrom the sentence may be unigrams. By way of an example, the sentenceis: “I work with American Express in United States of America.” Theunigrams identified for this sentence include: “Work,” “With,” “I,”“American,” “United,” “America,” “Express,” and “States.”

The one or more n-grams may be identified based on a confidence scoreassociated with each of the one or more n-grams. A confidence score foran n-gram is computed based on comparison of the n-gram with existingword patterns. The existing word patterns may be stored in a datarepository (not shown in FIG. 1) in communication with computing device102 via network 106. The existing word patterns may be added in the datarepository based on test data extracted from a word corpus that has anexhaustive list of word patterns. The data repository may becontinuously updated based on identification of new word patterns.

The confidence score for an n-gram may be computed based on associationcoefficient computed for degree of association of an n-gram relative toone or more adjacent words when compared with the existing wordpatterns. In an embodiment, for an identified unigram, the associationcoefficient is used to estimate whether the identified unigram istightly coupled with the existing word pattern or not. In other words,based on the association coefficient the probability of the identifiedunigram occurring alongside other words in the existing word patter isdetermined. Higher is the association coefficient, higher would be theconfidence score for the identified unigram occurring alongside otherwords. In an exemplary embodiment, the association coefficient may becomputed using equation 1 given below:

$\begin{matrix}{{{Association}\mspace{14mu} {Coefficient}\mspace{14mu} {for}\mspace{14mu} {Unigram}\mspace{14mu} {subtuples}} = {{\log \; \frac{ad}{bc}} - {3.29\sqrt{\frac{1}{a} + \frac{1}{b} + \frac{1}{c} + \frac{1}{d}}}}} & (1)\end{matrix}$

The confidence score thus uses co-occurrence and marginal frequenciesand are expressed as a, b, c, and d. The contingency table for thebigram (x y) is given below as table 1.

TABLE 1 a = f(xy) b = f(xy{circumflex over ( )}) f(x*) c =f(x{circumflex over ( )}y) d = f(x{circumflex over ( )}y{circumflex over( )}) f(x{circumflex over ( )}*) f(*y) f(*y{circumflex over ( )}) N

Where

f(xy) denotes the frequency of x and y occurring together;

f(xy{circumflex over ( )}) denotes the frequency of x and not y (i.e., xwith some other variables);

f(x{circumflex over ( )}y) denotes the frequency of y and not x (i.e., ywith some other variables); and

f(x{circumflex over ( )}y{circumflex over ( )}) denotes the frequency ofneither y nor x (i.e., x and y, both occurring with some othervariables).

If, based on the association coefficient, it is determined that theidentified unigram is loosely coupled, then the process does not moveahead for that identified unigram. By way of an example, the associationcoefficient for the unigram “American” occurring before the word“Express” will be high. However, the association coefficient for theunigram “America” occurring before the word “Express” will beconsiderably low. By way of an example for a unigram subtuple, theunigram subtuple scoring may be computed for the bigram “AmericanExpress”, where the unigrams are “American” and “Express.” Similarly,the words in a sentence are validated against the subtuple scoring and adecision is reached whether to consider it as an n-gram or not, based onthe association coefficient scoring.

In an embodiment, at step 302, seed patterns may be identified based onthe confidence of the unigram instances in the training data or theexiting word patterns. The confidence score for a unigram is computedbased on the unigram sub-tuple scoring mechanism given in equation 1above, where the word associated features and the co-occurrence featuresare used to compute the association coefficient. These seed examples arethen given for matching with the existing word patterns to extract theinstances that are precisely matched with one or more patterns in theexisting word patterns. The instances that are not exactly matched arethen processed for partial matching.

Thereafter, at step 304, based on the existing word patterns, computingdevice 102 determines a direction context entropy coefficient for eachof the one or more n-grams identified at step 302. The direction contextentropy coefficient includes a left context entropy coefficient and aright context entropy coefficient. When the left context entropycoefficient for the n-gram is higher than an associated predefinedcontext threshold, the n-gram is expanded in the left direction in thesentence. In continuation of the example above, for the unigram“America,” the left context entropy coefficient would be higher than theassociated predefined context threshold. Thus, the unigram “America”will be expanded in the left direction in the sentence.

Alternatively, when the right context entropy coefficient for the n-gramis higher than an associated predefined context threshold, the n-gram isexpanded in the right direction in the sentence. In continuation of theexample above, for the unigram “American,” the right context entropycoefficient would be higher than the associated predefined contextthreshold. Thus, the unigram “American” will be expanded in the rightdirection in the sentence.

In an exemplary embodiment, a left context entropy coefficient and aright context entropy coefficient for an n-gram may be computed usingthe equations 2 and 3 respectively given below:

$\begin{matrix}{{{Left}\mspace{14mu} {Context}\mspace{14mu} {Entropy}\mspace{14mu} {Coefficient}} = {- {\sum\limits_{w}{{P\left( w \middle| C_{xy}^{l} \right)}\log \; {P\left( w \middle| C_{xy}^{l} \right)}}}}} & (2) \\{{{Right}\mspace{14mu} {Context}\mspace{14mu} {Entropy}\mspace{14mu} {Coefficient}} = {- {\sum\limits_{w}{{P\left( w \middle| C_{xy}^{r} \right)}\log \; {P\left( w \middle| C_{xy}^{r} \right)}}}}} & (3)\end{matrix}$

-   -   where, table-2 given below, denotes different notations of        context measures used in equations 2 and 3 above:

TABLE 2 C_(w) Empirical context of w C_(xy) Empirical context of xyC^(l) _(xy) Left immediate context of xy C^(r) _(xy) Right immediatecontext of xy

Based on the associated direction context entropy coefficient, at step306, computing device 102, at each iteration, iteratively expands one ormore n-grams (identified at step 304) by the smallest n-gram unit in apredefined direction (i.e., left direction or right direction) in thesentence to generate one or more expanded n-grams. The smallest n-gramunit is a unigram. In other words, an n-gram is expanded by a unigram ateach iteration. Thus, if the left direction context entropy coefficientis greater than the associated predefined context threshold, the n-gramis expanded in the left direction in the sentence. In continuation ofthe example above, the unigram “America,” will be expanded in the leftdirection in the sentence, thereby generating a bigram “AmericanExpress”. Similarly, the unigram “American” will be expanded in theright direction in the sentence, thereby generating a bigram “ofAmerica.”

It will be apparent to a person skilled in the art that the step 306 iscarried out iteratively, and a current n-gram is expanded by a unigram(or a single word) in each iteration, such that, if direction contextentropy coefficient is computed for a bigram, the expanded n-gram wouldbe a trigram. Similarly, if direction context entropy coefficient iscomputed for a trigram, the expanded n-gram would be a tetra-gram.

At each expanding iteration, computing device 102, at step 308, extractsone or more expanded n-grams based on a confidence score associated witheach of the one or more expanded n-gram. In other words, after an n-gramhas been expanded to generate an expanded n-gram, first a confidencescore is computed for the expanded n-gram, and based on the confidencescore for the expanded n-gram, the expanded n-gram is extracted orignored. In an embodiment, the expanded n-gram is extracted ifconfidence score associated with the expanded n-gram is greater than anassociated threshold score. Thus, out of all expanded n-grams at step306, only those expanded n-grams are extracted, which have a confidencescore greater than the associated threshold.

A confidence score for an expanded n-gram is computed based oncomparison of the expanded n-gram with the existing word patterns. Thisis similar to the confidence score computed for an n-gram described instep 302 along with the equation 1 given as an exemplary embodiment.Thus, the confidence score for an expanded n-gram may also be computedbased on association coefficient computed for degree of association ofthe expanded n-gram relative to one or more adjacent words when comparedwith the existing word patterns. In an embodiment, for a bigramgenerated after expanding a unigram, the association coefficient is usedto estimate whether the bigram is tightly coupled with the existing wordpattern or not. Higher is the association coefficient, higher would bethe confidence score for the expanded n-gram occurring alongside otherwords. In continuation of the example above, the bigram “AmericanExpress” has a high confidence score, as it would match with existingword patterns. As a result, the bigram “American Express” will beextracted. Similarly, the bigram “of America” would also be extracted.In this case, in the subsequent iterations, the trigram “states ofAmerica” and the tetra-gram “United States of America” would beextracted.

Thereafter, at step 310, a check is performed to determine whether apredefined iteration threshold has been reached. In an embodiment, thepredefined iteration threshold may be set to a number of iterationsdecided by the administrator. In another embodiment, the predefinediteration threshold is reached when no new patterns and/or n-grams areavailable or identified. This step is essential as one of the importantaspect of n-gram identification is boundary detection, i.e., when tostop n-gram expansion. It is necessary to detect the boundary, becausen-gram instances are of variable length and thus new pattern detectioncan stop at different iterations. This boundary detection is thushelpful in limiting the iterations with respect to the length of then-grams. If the number of iterations are not limited, there is apossibility of getting overfitting issues, that result in obtaining moreabstract level patterns. These abstract level patterns may further leadto the extraction of more false positive instances or n-grams. When thepredefined iteration threshold has not been reached, the control goesback to step 304. In other words, an expanded n-gram extracted at step308 would further be processed at step 304 and a direction contextentropy coefficient for the expanded n-grams would be determined.Thereafter, step 306 and 310 would be repeated.

Referring back to step 310, when the predefined iteration threshold hasnot been reached, computing device 102, at step 312, groups semanticallylinked n-grams from the one or more expanded n-grams extracted at step308. Thus, the semantically similar and semantically related instancesor n-grams, which are not captured and/or ignored in the previous stagesof bootstrapping algorithm are identified and extracted. The semanticsimilarity between words are captured through knowledge sources, suchas, but not limited to semantic ontology and Wordnet. With the use ofsemantic ontology, the similar words are identified through hierarchicalrelations between those words. However, in order to avoid theoverfilling problem discussed above, the level of super-class andsub-class relationships are restricted to a predefined threshold.Similarly, the Wordnet relations are utilized to identify the synonymsof the words. In such a way, the semantically related and similarn-grams are grouped together.

Referring now to FIGS. 4A and 4B, a flowchart of a method foridentifying and extracting n-grams from sentences is illustrated, inaccordance with another embodiment. Once a sentence has been inputted bya user, computing device 102, at step 402, identifies one or moren-grams from the sentence. The one or more n-grams may be identifiedbased on a confidence score associated with each of the one or moren-grams. A confidence score for an n-gram is computed based oncomparison of the n-gram with existing word patterns. The existing wordpatterns may be stored in a data repository (not shown in FIG. 1) incommunication with computing device 102 via network 106. The confidencescore for an n-gram may be computed based on association coefficientcomputed for degree of association of an n-gram relative to one or moreadjacent words when compared with the existing word patterns. In anembodiment, for an identified unigram, the association coefficient isused to estimate whether the identified unigram is tightly coupled withthe existing word pattern or not. This has been explained in detail inconjunction with FIG. 3.

Thereafter, at step 404, based on the existing word patterns, computingdevice 102 determines a direction context entropy coefficient for eachof the one or more n-grams identified at step 402. The direction contextentropy coefficient includes a left context entropy coefficient and aright context entropy coefficient. This has been explained in detail inconjunction with FIG. 3. At step 406, a check is performed to determinewhether direction context entropy coefficient for each of the one ormore n-grams identified at step 402 satisfy an expansion criterion. Theexpansion criterion may be a direction context entropy coefficient(either left context entropy coefficient or either right context entropycoefficient left being greater than the associated predefined contextthreshold.

When direction context entropy coefficient for each of the one or moren-grams identified at step 402 satisfy an expansion criterion, at step408, at each iteration, the one or more n-grams (identified at step 402)are expanded by the smallest n-gram unit in a predefined direction(i.e., left direction or right direction) in the sentence to generateone or more expanded n-grams, based on the associated direction contextentropy coefficient. This has been explained in detail in conjunctionwith FIG. 3. Thereafter, at step 410, expansion of each of the one ormore n-grams in the predefined direction is validated. The validationfor an n-gram is performed based on one or more of an associated crosscontext entropy coefficient and an associated reverse cross contextentropy coefficient. These measures will give the confidence to expandeach of the one or more n-grams identified at step 402, in order todecide whether to expand an n-gram or to stop expansion of the n-gram.In an exemplary embodiment, equations 4 and 5 may respectively be usedto compute cross context entropy coefficient and reverse cross contextentropy coefficient for an n-gram:

$\begin{matrix}{{{Cross}\mspace{14mu} {Entropy}\mspace{14mu} {Coefficient}} = {- {\sum\limits_{w}{{P\left( w \middle| C_{x} \right)}\log \; {P\left( w \middle| C_{y} \right)}}}}} & (4) \\{{{Reverse}\mspace{14mu} {Cross}\mspace{14mu} {Entropy}\mspace{14mu} {Coefficient}} = {- {\sum\limits_{w}{{P\left( w \middle| C_{y} \right)}\log \; {P\left( w \middle| C_{x} \right)}}}}} & (5)\end{matrix}$

where, table-3 given below, denotes different notations of contextmeasures used in equations 4 and 5 above:

TABLE 3 W Empirical context of w C_(x) Empirical context of x C_(y)Empirical context of y

If one or more expanded n-grams fail to get validated, these expandedn-grams are not processed further. At step 412, at each expandingiteration, one or more expanded n-grams (which have been validated) areextracted based on an associated confidence score. Extraction ofexpanded n-grams has been explained in detail in conjunction with FIG.3. At step 414, one or more of the expanded n-grams are filtered basedon associated one or more context divergence coefficients. Each of oneor more filtered n-grams have low relevancy confidence score, which isdetermined based on the associated one or more context divergencecoefficients. The one or more context divergence coefficients include aleft context divergence coefficient and a right context divergencecoefficient. The left context divergence coefficient for an n-gram isexact opposite of the left context entropy coefficient for the n-gram.Similarly, the right context divergence coefficient for an n-gram isexact opposite of the right context entropy coefficient for the n-gram.The one or more context divergence coefficients further include a skewdivergence coefficient and a reverse skew divergence coefficient, thatvalidate the result obtained from the left and right context divergencecoefficients. In an exemplary embodiment, one or more context divergencecoefficients are represented using equations 6, 7, 8, and 9 given below:

$\begin{matrix}{{{Left}\mspace{14mu} {Context}\mspace{14mu} {Divergence}\mspace{14mu} {Coefficient}} = {{{P\left( x^{*} \right)}\log \; {P\left( x^{*} \right)}} - {\sum\limits_{w}{{P\left( w \middle| C_{xy}^{l} \right)}\log \; {P\left( w \middle| C_{xy}^{l} \right)}}}}} & 6 \\{{{Right}\mspace{14mu} {Context}\mspace{14mu} {Divergence}\mspace{14mu} {Coefficient}} = {{P\left( {\,^{*}y} \right)} - {\log \; {P\left( {\,^{*}y} \right)}{\sum\limits_{w}{{P\left( w \middle| C_{xy}^{r} \right)}\log \; {P\left( w \middle| C_{xy}^{r} \right)}}}}}} & 7 \\{{{Skew}\mspace{14mu} {Divergence}\mspace{14mu} {Coefficient}} = {D\left( {p\left( w \middle| C_{x} \right)}||{{\frac{1}{2}{p\left( w \middle| C_{y} \right)}} + {\frac{1}{2}{p\left( w \middle| C_{x} \right)}}} \right)}} & 8 \\{{{Reverse}\mspace{14mu} {Skew}\mspace{14mu} {Divergence}\mspace{14mu} {Coefficient}} = {D\left( {p\left( w \middle| C_{y} \right)}||{{\frac{1}{2}{p\left( w \middle| C_{x} \right)}} + {\frac{1}{2}{p\left( w \middle| C_{y} \right)}}} \right)}} & 9\end{matrix}$

where, table 4 given below, denotes different notations of contextmeasures used in equations 6, 7, 8, and 9 given above:

TABLE 4 C_(w) Empirical context of w C_(xy) Empirical context of xyC^(l) _(xy) Left immediate context of xy C^(r) _(xy) Right immediatecontext of xy

Filtering n-grams with low confidence in the corpus based on one or morecontext divergence coefficients results in obtaining maximum meaningfuln-grams. Additionally, based on divergence of the n-grams, thesemantically related and similar items are also identified. Thereafter,at step 416, a check is performed to determine if maximum number ofiterations have been exhausted. This has been explained in conjunctionwith step 310 of FIG. 3. When maximum number of iterations have not beenreached, the control goes back to step 408. However, when maximum numberof iterations have been reached, at step 418, semantically linkedn-grams from the one or more expanded n-grams obtained after filteringare grouped. This has been explained in detail in conjunction with FIG.3.

Referring back to step 406, when direction context entropy coefficientfor each of the one or more n-grams (identified at step 402) does notsatisfy expansion criterion, at step 420, one or more n-grams from theone or more n-grams (identified at step 402) are removed. The one ormore n-grams that are removed cannot be expanded by the smallest n-gramunit based on the associated direction context entropy coefficient.Thereafter, steps 422 to 428 are executed for the remaining one or moren-grams after removal of one or more n-grams not satisfying theexpansion criterion. After step 428, the control goes to step 416, wherea check is performed to determine if maximum number of iterations havebeen exhausted. This has been explained in conjunction with step 310 ofFIG. 3. When maximum number of iterations have not been reached, thecontrol goes back to step 422. However, when maximum number ofiterations have been reached, at step 418, semantically linked n-gramsfrom the one or more expanded n-grams obtained after filtering aregrouped. This has been explained in detail in conjunction with FIG. 3.

FIG. 5 is a block diagram of an exemplary computer system forimplementing various embodiments. Computer system 502 may include acentral processing unit (“CPU” or “processor”) 504. Processor 504 mayinclude at least one data processor for executing program components forexecuting user- or system-generated requests. A user may include aperson, a person using a device such as such as those included in thisdisclosure, or such a device itself. Processor 504 may includespecialized processing units such as integrated system (bus)controllers, memory management control units, floating point units,graphics processing units, digital signal processing units, etc.Processor 504 may include a microprocessor, such as AMD® ATHLON®microprocessor, DURON® microprocessor OR OPTERON® microprocessor, ARM'sapplication, embedded or secure processors, IBM® POWERPC®, INTEL'S CORE®processor, ITANIUM® processor, XEON® processor, CELERON® processor orother line of processors, etc. Processor 504 may be implemented usingmainframe, distributed processor, multi-core, parallel, grid, or otherarchitectures. Some embodiments may utilize embedded technologies likeapplication-specific integrated circuits (ASICs), digital signalprocessors (DSPs), Field Programmable Gate Arrays (FPGAs), etc.

Processor 504 may be disposed in communication with one or moreinput/output (I/O) devices via an I/O interface 506. I/O interface 506may employ communication protocols/methods such as, without limitation,audio, analog, digital, monoaural, RCA, stereo, IEEE-1394, serial bus,universal serial bus (USB), infrared, PS/2, BNC, coaxial, component,composite, digital visual interface (DVI), high-definition multimediainterface (HDMI), RE antennas, S-Video, VGA, IEEE 802.n/b/g/n/x,Bluetooth, cellular (e.g., code-division multiple access (CDMA),high-speed packet access (HSPA+), global system for mobilecommunications (GSM), long-term evolution (LTE), WiMax, or the like),etc.

Using I/O interface 506, computer system 502 may communicate with one ormore I/O devices. For example, an input device 508 may be an antenna,keyboard, mouse, joystick, (infrared) remote control, camera, cardreader, fax machine, dongle, biometric reader, microphone, touch screen,touchpad, trackball, sensor (e.g., accelerometer, light sensor, GPS,gyroscope, proximity sensor, or the like), stylus, scanner, storagedevice, transceiver, video device/source, visors, etc. An output device510 may be a printer, fax machine, video display (e.g., cathode ray tube(CRT), liquid crystal display (LCD), light-emitting diode (LED), plasma,or the like), audio speaker, etc. In some embodiments, a transceiver 512may be disposed in connection with processor 504. Transceiver 512 mayfacilitate various types of wireless transmission or reception. Forexample, transceiver 512 may include an antenna operatively connected toa transceiver chip (e.g., TEXAS® INSTRUMENTS WILINK WL1283® transceiver,BROADCOM® BCM4550IUB8® transceiver, INFINEON TECHNOLOGIES® X-GOLD618-PMB9800® transceiver, or the like), providing IEEE 802.6a/b/g/n,Bluetooth, FM, global positioning system (GPS), 2G/3G HSDPA/HSUPAcommunications, etc.

In some embodiments, processor 504 may be disposed in communication witha communication network 514 via a network interface 516. Networkinterface 516 may communicate with communication network 514. Networkinterface 516 may employ connection protocols including, withoutlimitation, direct connect, Ethernet (e.g., twisted pair 50/500/5000Base T), transmission control protocol/Internet protocol (TCP/IP), tokenring, IEEE 802.11a/b/g/n/x, etc, Communication network 514 may include,without limitation, a direct interconnection, local area network (LAN),wide area network (WAN), wireless network (e.g., using WirelessApplication Protocol), the Internet, etc. Using network interface 516and communication network 514, computer system 502 may communicate withdevices 518, 520, and 522. These devices may include, withoutlimitation, personal computer(s), server(s), fax machines, printers,scanners, various mobile devices such as cellular telephones,smartphones (e.g., APPLE® IPHONE® smartphone, BLACKBERRY® smartphone,ANDROID® based phones, etc.), tablet computers, eBook readers (AMAZON®KINDLE® ereader, NOOK® tablet computer, etc.), laptop computers,notebooks, gaming consoles (MICROSOFT® XBOX® gaming console, NINTENDO®DS® gaming console, SONY® PLAYSTATION® gaming console, etc.), or thelike. In some embodiments, computer system 502 may itself embody one ormore of these devices.

In some embodiments, processor 504 may be disposed in communication withone or more memory devices (e.g., RAM 526, ROM 528, etc.) via a storageinterface 524. Storage interface 524 may connect to memory 530including, without limitation, memory drives, removable disc drives,etc., employing connection protocols such as serial advanced technologyattachment (SATA), integrated drive electronics (IDE), IEEE-1394,universal serial bus (USB), fiber channel, small computer systemsinterface (SCSI), etc. The memory drives may further include a drum,magnetic disc drive, magneto-optical drive, optical drive, redundantarray of independent discs (RAID), solid-state memory devices,solid-state drives, etc.

Memory 530 may store a collection of program or database components,including, without limitation, an operating system 532, user interfaceapplication 534, web browser 536, mail server 538, mail client 540,user/application data 542 (e.g., any data variables or data recordsdiscussed in this disclosure), etc. Operating system 532 may facilitateresource management and operation of computer system 502. Examples ofoperating systems 532 include, without limitation, APPLE® MACINTOSH® OSX platform, UNIX platform, Unix-like system distributions (e.g.,Berkeley Software Distribution (BSD), FreeBSD, NetBSD, OpenBSD, etc.),LINUX distributions (e.g., RED HAT®, UBUNTU®, KUBUNTU®, etc.), IBM® OS/2platform, MICROSOFT® WINDOWS® platform (XP, Vista/7/8, etc.), APPLE®IOS® platform, GOOGLE® ANDROID® platform, BLACKBERRY® OS platform, orthe like. User interface 534 may facilitate display, execution,interaction, manipulation, or operation of program components throughtextual or graphical facilities. For example, user interfaces mayprovide computer interaction interface elements on a display systemoperatively connected to computer system 502, such as cursors, icons,check boxes, menus, scrollers, windows, widgets, etc. Graphical userinterfaces (GUIs) may be employed, including, without limitation, APPLE®Macintosh® operating systems' AQUA® platform, IBM® OS/2® platform,MICROSOFT® WINDOWS® platform (e.g., AERO® platform, METRO® platform,etc.), UNIX X-WINDOWS, web interface libraries (e.g., ACTIVEX® platform,JAVA® programming language, JAVASCRIPT® programming language, AJAX®programming language, HTML, ADOBE® FLASH® platform, etc.), or the like.

In some embodiments, computer system 502 may implement a web browser 536stored program component. Web browser 536 may be a hypertext viewingapplication, such as MICROSOFT® INTERNET EXPLORER® web browser, GOOGLE®CHROME® web browser, MOZILLA® FIREFOX® web browser, APPLE® SAFARI®browser, etc. Secure web browsing may be provided using HTTPS (securehypertext transport protocol), secure sockets layer (SSL), TransportLayer Security (TLS), etc. Web browsers may utilize facilities such asAJAX, DHTML, ADOBE® FLASH® platform, JAVASCRIPT® programming language,JAVA® programming language, application programming interfaces (APis),etc. In some embodiments, computer system 502 may implement a mailserver 538 stored program component. Mail server 538 may be an Internetmail server such as MICROSOFT® EXCHANGE® mail server, or the like. Mailserver 538 may utilize facilities such as ASP, ActiveX, ANSI C++/C#,MICROSOFT .NET® programming language, CGI scripts, JAVA® programminglanguage, JAVASCRIPT® programming language, PERL® programming language,PHP® programming language, PYTHON® programming language, WebObjects,etc. Mail server 538 may utilize communication protocols such asinternet message access protocol (IMAP), messaging applicationprogramming interface (MAPI), Microsoft Exchange, post office protocol(POP), simple mail transfer protocol (SMTP), or the like. In someembodiments, computer system 502 may implement a mail client 540 storedprogram component. Mail client 540 may be a mail viewing application,such as APPLE MAIL® mail client, MICROSOFT ENTOURAGE® mail client,MICROSOFT OUTLOOK® mail client, MOZILLA THUNDERBIRD® mail client, etc.

In some embodiments, computer system 502 may store user/application data542, such as the data, variables, records, etc. as described in thisdisclosure. Such databases may be implemented as fault-tolerant,relational, scalable, secure databases such as ORACLE® database ORSYBASE® database. Alternatively, such databases may be implemented usingstandardized data structures, such as an array, hash, linked list,struct, structured text file (e.g., XML), table, or as object-orienteddatabases (e.g., using OBJECTSTORE® object database, POET® objectdatabase, ZOPE® object database, etc.). Such databases may beconsolidated or distributed, sometimes among the various computersystems discussed above in this disclosure. It is to be understood thatthe structure and operation of the any computer or database componentmay be combined, consolidated, or distributed in any workingcombination.

It will be appreciated that, for clarity purposes, the above descriptionhas described embodiments of the invention with reference to differentfunctional units and processors. However, it will be apparent that anysuitable distribution of functionality between different functionalunits, processors or domains may be used without detracting from theinvention. For example, functionality illustrated to be performed byseparate processors or controllers may be performed by the sameprocessor or controller. Hence, references to specific functional unitsare only to be seen as references to suitable means for providing thedescribed functionality, rather than indicative of a strict logical orphysical structure or organization.

Various embodiments of the invention provide method and device forn-gram identification and extraction. The method identifies and extractn-grams from text. In order to achieve this, a bootstrapping basedsemi-supervised learning algorithm is used, which takes a set of seedpatterns as input and extract all the possible matched instances, bothexact and partial. The use of association, context, and divergencemeasures are computed at different stages of the bootstrapping algorithmso as to obtain the confidence of the n-grams and validate itsconfidence. The method is useful in natural language processingapplications, such as, machine Translation, sequence identification andextraction. The method is additionally useful in identifying phrasalterms and complex phrases of different languages and in sequence tosequence matching while converting or translating from one language tothe other.

The specification has described method and device for method and devicefor n-gram identification and extraction. The illustrated steps are setout to explain the exemplary embodiments shown, and it should beanticipated that ongoing technological development will change themanner in which particular functions are performed. These examples arepresented herein for purposes of illustration, and not limitation.Further, the boundaries of the functional building blocks have beenarbitrarily defined herein for the convenience of the description.Alternative boundaries can be defined so long as the specified functionsand relationships thereof are appropriately performed, Alternatives(including equivalents, extensions, variations, deviations, etc., ofthose described herein) will be apparent to persons skilled in therelevant art(s) based on the teachings contained herein. Suchalternatives fall within the scope and spirit of the disclosedembodiments.

Furthermore, one or more computer-readable storage media may be utilizedin implementing embodiments consistent with the present disclosure. Acomputer-readable storage medium refers to any type of physical memoryon which information or data readable by a processor may be stored.Thus, a computer-readable storage medium may store instructions forexecution by one or more processors, including instructions for causingthe processor(s) to perform steps or stages consistent with theembodiments described herein. The term “computer-readable medium” shouldbe understood to include tangible items and exclude carrier waves andtransient signals, i.e., be non-transitory. Examples include randomaccess memory (RAM), read-only memory (ROM), volatile memory,nonvolatile memory, hard drives, CD ROMs, DVDs, flash drives, disks, andany other known physical storage media.

It is intended that the disclosure and examples be considered asexemplary only, with a true scope and spirit of disclosed embodimentsbeing indicated by the following claims.

1. A method for n-gram identification and extraction, the methodcomprising: identifying, by a computing device, at least one n-gram froma sentence inputted by a user based on a confidence score associatedwith each of the at least one n-gram, wherein a confidence score for ann-gram is computed based on comparison of the n-gram with existing wordpatterns; determining, by the computing device, a direction contextentropy coefficient for each of the at least one n-gram, based on theexisting word patterns; iteratively expanding, by the computing device,one or more of the at least one n-gram by the smallest n-gram unit ateach iteration in a predefined direction in the sentence to generate atleast one expanded n-gram, based on an associated direction contextentropy coefficient, wherein the one or more of the at least one n-gramis iteratively expanded until obtaining maximum meaningful n-grams inthe predefined direction; validating, by the computing device, expansionof the n-gram in the predefined direction based on a cross contextentropy coefficient and a reverse cross context entropy coefficient;extracting at each expanding iteration, by the computing device, one ormore of the at least one expanded n-gram based on a confidence scoreassociated with each of the one or more of the at least one expandedn-gram, wherein a confidence score for an expanded n-gram is computedbased on comparison of the expanded n-gram with the existing wordpatterns; and grouping, by the computing device, semantically linkedn-grams from the one or more of the at least one expanded n-gram.
 2. Themethod of claim 1, further comprising removing one or more n-grams fromthe at least one n-gram, wherein the one or more n-grams cannot beexpanded by the smallest n-gram unit based on the associated directioncontext entropy coefficient.
 3. The method of claim 1, wherein thepredefined direction comprises one of left direction and right directionin the sentence with respect to an n-gram from the at least one n-gram.4. The method of claim 1, wherein the smallest n-gram unit is a unigram,and wherein the n-gram is expanded by the unigram in the predefineddirection in each iteration to generate an (n+1)-gram.
 5. The method ofclaim 1, wherein the confidence score for the n-gram is computed basedon an association coefficient computed for degree of association of then-gram relative to at least one adjacent word when compared with theexisting word patterns.
 6. The method of claim 1, wherein the directioncontext entropy coefficient for the n-gram comprises at least one of aleft context entropy coefficient and a right context entropycoefficient, wherein the n-gram is expanded in the left direction in thesentence, when the left context entropy coefficient for the n-gram ishigher than an associated predefined context threshold, and wherein then-gram is expanded in the right direction in the sentence, when theright context entropy coefficient for the n-gram is higher than theassociated predefined context threshold.
 7. (canceled)
 8. The method ofclaim 1, further comprising filtering one or more of the at least onen-gram and one or more of the at least one expanded n-gram based onassociated at least one context divergence coefficient.
 9. The method ofclaim 8, wherein each of one or more filtered n-grams comprise lowrelevancy confidence score determined based on the associated at leastone context divergence coefficient.
 10. The method of claim 1, furthercomprising limiting the number of expanding iterations based on apredefined iteration threshold.
 11. A computing device for n-gramidentification and extraction, the computing device comprises: aprocessor; and a memory communicatively coupled to the processor,wherein the memory stores processor instructions, which, on execution,causes the processor to: identify at least one n-gram from a sentenceinputted by a user based on a confidence score associated with each ofthe at least one n-gram, wherein a confidence score for an n-gram iscomputed based on comparison of the n-gram with existing word patterns;determine a direction context entropy coefficient for each of the atleast one n-gram, based on the existing word patterns; iterativelyexpand one or more of the at least one n-gram by the smallest n-gramunit at each iteration in a predefined direction in the sentence togenerate at least one expanded n-gram, based on an associated directioncontext entropy coefficient, wherein the one or more of the at least onen-gram is iteratively expanded until obtaining maximum meaningfuln-grams in the predefined direction; validate, by the computing device,expansion of the n-gram in the predefined direction based on a crosscontext entropy coefficient and a reverse cross context entropycoefficient; extract at each expanding iteration one or more of the atleast one expanded n-gram based on a confidence score associated witheach of the one or more of the at least one expanded n-gram, wherein aconfidence score for an expanded n-gram is computed based on comparisonof the expanded n-gram with the existing word patterns; and groupsemantically linked n-grams from the one or more of the at least oneexpanded n-gram.
 12. The computing device of claim 11, wherein theprocessor instructions further cause the processor to remove one or moren-grams from the at least one n-gram, wherein the one or more n-gramscannot be expanded by the smallest n-gram unit based on the associateddirection context entropy coefficient.
 13. The computing device of claim11, wherein the predefined direction comprises one of left direction andright direction in the sentence with respect to an n-gram from the atleast one n-gram.
 14. The computing device of claim 11, wherein theconfidence score for the n-gram is computed based on an associationcoefficient computed for degree of association of the n-gram relative toat least one adjacent word when compared with the existing wordpatterns.
 15. The computing device of claim 1, wherein the directioncontext entropy coefficient for the n-gram comprises at least one of aleft context entropy coefficient and a right context entropycoefficient, wherein the n-gram is expanded in the left direction in thesentence, when the left context entropy coefficient for the n-gram ishigher than an associated predefined context threshold, and wherein then-gram is expanded in the right direction in the sentence, when theright context entropy coefficient for the n-gram is higher than theassociated predefined context threshold.
 16. (canceled)
 17. Thecomputing device of claim 11, wherein the processor instructions furthercause the processor to filter one or more of the at least one n-gram andone or more of the at least one expanded n-gram based on associated atleast one context divergence coefficient.
 18. The computing device ofclaim 17, wherein each of one or more filtered n-grams comprise lowrelevancy confidence score determined based on the associated at leastone context divergence coefficient.
 19. The computing device of claim11, wherein the processor instructions further cause the processor tolimit the number of expanding iterations based on a predefined iterationthreshold.
 20. A non-transitory computer-readable storage medium havingstored thereon, a set of computer-executable instructions causing acomputer comprising one or more processors to perform steps comprising:identifying at least one n-gram from a sentence inputted by a user basedon a confidence score associated with each of the at least one n-gram,wherein a confidence score for an n-gram is computed based on comparisonof the n-gram with existing word patterns; determining a directioncontext entropy coefficient for each of the at least one n-gram, basedon the existing word patterns; iteratively expanding one or more of theat least one n-gram by the smallest n-gram unit at each iteration in apredefined direction in the sentence to generate at least one expandedn-gram, based on an associated direction context entropy coefficient,wherein the one or more of the at least one n-gram is iterativelyexpanded until obtaining maximum meaningful n-grams in the predefineddirection; validating, by the computing device, expansion of the n-gramin the predefined direction based on a cross context entropy coefficientand a reverse cross context entropy coefficient; extracting at eachexpanding iteration one or more of the at least one expanded n-grambased on a confidence score associated with each of the one or more ofthe at least one expanded n-gram, wherein a confidence score for anexpanded n-gram is computed based on comparison of the expanded n-gramwith the existing word patterns; and grouping semantically linkedn-grams from the one or more of the at least one expanded n-gram.